<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:message key="titulo.pesquisa" var="title">
    <fmt:param>
        <fmt:message key="titulo.grupo" />
    </fmt:param>
</fmt:message>
<fmt:message key="acao.deletar" var="msgDelete">
    <fmt:param>
        <fmt:message key="entidade.grupo" />
    </fmt:param>
</fmt:message>
<%@ include file="/WEB-INF/jsp/includes/topo.jspf" %>
    <script type="text/javascript">
        $(document).ready(function() {
            $(".formExcluir").bind("click", function() {
                if (confirm('${msgDelete}')) {
                    this.submit();
                }
            });

            $("table.listagem").dataTable({
                "order": [[0, "asc"]],
                "columns": [
                    {
                        "width": "5%"
                    },
                    null,
                    {
                        "orderable": false,
                        "width": "8%"
                    },
                    {
                        "orderable": false,
                        "width": "8%"
                    }
                ],
                "oLanguage": {
                    "sEmptyTable": "Nenhum registro encontrado na tabela",
                    "sInfo": "Mostrar _START_ até _END_ do _TOTAL_ registros",
                    "sInfoEmpty": "Mostrar 0 até 0 de 0 Registros",
                    "sInfoFiltered": "(Filtrar de _MAX_ total registros)",
                    "sInfoPostFix": "",
                    "sInfoThousands": ".",
                    "sLengthMenu": "Mostrar _MENU_ registros por pagina",
                    "sLoadingRecords": "Carregando...",
                    "sProcessing": "Processando...",
                    "sZeroRecords": "Nenhum registro encontrado",
                    "sSearch": "Pesquisar:",
                    "oPaginate": {
                        "sNext": "Proximo",
                        "sPrevious": "Anterior",
                        "sFirst": "Primeiro",
                        "sLast": "Ultimo"
                    },
                    "oAria": {
                        "sSortAscending": ": Ordenar colunas de forma ascendente",
                        "sSortDescending": ": Ordenar colunas de forma descendente"
                    }
                }
            });
        });
    </script>
    <form action="${path}/pages/grupo" method="GET" accept-charset="UTF-8" id="pesqGrupo" class="formCadastro">
        <label><fmt:message key="campo.nome" /></label>
        <input type="text" name="entidade.nome" value="${entidade.nome}" size="60" />
        <input type="submit" value="<fmt:message key='acao.pesquisar' />"  />
        <input type="button" value="<fmt:message key='acao.limpar' />" onclick="javascript:window.location.assign('${path}/pages/grupo')" />
        <input type="button" value="<fmt:message key='acao.novo' />" onclick="javascript:window.location.assign('${path}/pages/grupo/novo')" />
    </form>
    <table border="1" class="listagem display">
        <thead>
            <tr>
                <th><fmt:message key="campo.id" /></th>
                <th><fmt:message key="campo.nome" /></th>
                <th><fmt:message key="acao.editar" /></th>
                <th><fmt:message key="acao.excluir" /></th>
            </tr>
        </thead>
        <tbody>
        <c:forEach items="${secgrupoList}" var="grupo">
            <tr>
                <td class="center">${grupo.id}</td>
                <td>${grupo.nome}</td>
                <td class="center">
                    <a href="${path}/pages/grupo/buscar/${grupo.id}">
                        <img src="${path}/resources/imgs/editar.png" alt="editar" />
                    </a>
                </td>
                <td class="center">
                    <form class="formExcluir" action="${path}/pages/grupo/remover/${grupo.id}" method="POST">
                        <input type="hidden" name="_method" value="DELETE" />
                        <span>
                            <img src="${path}/resources/imgs/excluir.png" alt="excluir" />
                        </span>
                    </form>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
<%@ include file="/WEB-INF/jsp/includes/rodape.jspf" %>